<template>
  <a-table :dataSource="dataSource" :columns="columns" />
</template>
<script lang="ts">
import {defineComponent,onMounted,ref} from "vue";
import axios from "axios";



export default {
  name: "Ingredient",
  setup() {
//食材后端接口
    const ingredients = ref();
    onMounted(()=>{
      console.log('onMounted22');
      axios.get("食材信息的URL").then((response) => {
        const data = response.data;
        ingredients.value = data;
      });
    });
    return {
      dataSource: [
        {
          key: '1',
          ingtName: '胡萝卜',
          supplier: '32',
          canteenBelonger: '西湖区湖底公园1号',
          storeTime: '2021年9月1日12:00',
          ingtSlife: '一个月',
        }
      ],

      columns: [
        {
          title: '食材名称',
          dataIndex: 'ingtName',
          key: 'ingtName',
        },
        {
          title: '供应商',
          dataIndex: 'supplier',
          key: 'supplier',
        },
        {
          title: '所属食堂',
          dataIndex: 'canteenBelonger',
          key: 'canteenBelonger',
        },
        {
          title: '进货时间',
          dataIndex: 'storeTime',
          key: 'storeTime',
        },
        {
          title: '食材保质期',
          dataIndex: 'ingtSlife',
          key: 'ingtSlife',
        }
      ],
    };
  },
};
</script>

<style scoped>

</style>